package cn.gailvlun.gll.presentation.apartment.room.dialog;

import android.app.Dialog;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Window;

import cn.gailvlun.gll.R;
import cn.gailvlun.gll.databinding.DialogMatchSuccessBinding;
import cn.gailvlun.gll.net.Member;
import cn.gailvlun.gll.net.base.Profile;



public class MatchSuccessDialog extends Dialog {

    private DialogMatchSuccessBinding mBinding;

    public MatchSuccessDialog(@NonNull Context context, Member member) {
        super(context);

        mBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_match_success, null, false);
        mBinding.setPresenter(new Presenter());
        mBinding.setItem(member.getOwner());
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Window window = getWindow();
        window.requestFeature(Window.FEATURE_NO_TITLE);

        setContentView(mBinding.getRoot());
    }

    public class Presenter {
        public void onStayInRoom() {
            if (mOnMatchListener != null) {
                mOnMatchListener.onStayInRoom(MatchSuccessDialog.this);
            }
        }

        public void iKnow() {
            if (mOnMatchListener != null) {
                mOnMatchListener.iKnow(MatchSuccessDialog.this);
            }
        }
    }

    public interface OnMatchListener {
        void onStayInRoom(MatchSuccessDialog dialog);
        void iKnow(MatchSuccessDialog dialog);
    }

    private OnMatchListener mOnMatchListener;

    public void setOnMatchListener(OnMatchListener onMatchListener) {
        mOnMatchListener = onMatchListener;
    }
}
